let questionInfoApp = new Vue({
    el:'#questionInfoApp',
    data:{
        question:{
            tags:{

            }
        }
    },
    methods:{
        loadQuestion:function () {
            //地址栏问号后面的值
            let id = location.search;
            if(!id){
                alert("非法访问!参数不足！");
                location.href='/index.html';
            }
            id = id.substring(1);
            if (!id || isNaN(id)) { // is not a number
                alert("非法访问！参数不足！");
                location.href = '/index.html';
                return;
            }
            $.ajax({
                url:'/api/v1/questions/' + id,
                success: function(json) {
                    if (json.state == 2000) {
                        let question = json.data;
                        question.createdTimeText = getCreatedTimeText(question.createdTime);
                        questionInfoApp.question = question;
                    } else {
                        alert(json.message);
                        location.href = "/index.html";
                    }
                }
            });

        }
    },
    created:function () {
        this.loadQuestion();
    }
});